package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.dto.SetmealDTO;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.service.SetmealService;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import com.sky.vo.ShoppingCartADDVO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.beans.factory.annotation.Autowired;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface SetmealMapper {
    @Insert("insert into setmeal values(#{id},#{categoryId},#{name},#{price},#{status},#{description},#{image},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void add(Setmeal meal);
    @Select("select id from setmeal where image = #{imageurl}")
    Long getBytime(String imageurl);
    List<SetmealVO> getbypage(SetmealPageQueryDTO dto);
    @Select("select count(*) from setmeal")
    Long getcounts();
    @Select("select name from category where id = #{categoryId}")
    String getnamebycategoryid(SetmealVO vo);
    @Select("select name from setmeal where category_id = #{categoryId}")
    String getnamebycategoryid_(Long categoryId);
    @Update("update setmeal set status = #{status} where id = #{id}")
    void startorstop(Integer status,Long id);
    @Select("select * from setmeal where id = #{id}")
    Setmeal getmealByid(Long id);
    @Select("select status from setmeal where id = #{id}")
    Integer getSatusByid(Long id);
    void update(Setmeal meal);
    void deleteByid(String[] ids);
    @Select("select id from setmeal where category_id = {categoryid}")
    String []getidBycategoryid(Long categoryid);
    @Select("select * from setmeal where category_id = #{categoryid}")
    List<Setmeal> getBycategoryId(Integer categoryid);
    @Select("select image,name,price from setmeal where id = #{id}")
    ShoppingCartADDVO get(Long id);
    List<DishItemVO> getvos(Long id);
}
